
# array 5
# i = 0 inner loop: 4
# i = 1             3
# i = 2             2
# i = 3             1
# i = 4             0 X
# 10
# 1 + 2 + 3 + (5-1)
# 6 1+2+...+5
# 7 1+2+...+6
# n 1+2+...+(n-1) = n*(n-1)/2 = (n^2 - n) / 2
# n = 10 n^2 = 100
# n = 100 n^2 = 10000
# n = 1000 n^2 = 1000000
# n 足够大的时候，n^2 就远远大于 n，以至于 n 的值就可以忽略不计了
# BigO
# O(n^2)
def twoNumberSum(array, targetSum):

  for i in range(len(array) - 1):
    firstNum = array[i]

    for j in range(i + 1, len(array)):
      secondNum = array[j]

      if firstNum + secondNum == targetSum:
        return [firstNum, secondNum]

  return []